package com.example.demo.entity;
import com.fasterxml.jackson.annotation.JsonIgnore;
import org.springframework.stereotype.Component;
import java.io.Serializable;
import java.util.Date;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SerializeConfig;
import com.alibaba.fastjson.serializer.SerializerFeature;

@Component
public class User implements Serializable {
    private static final long serialVersionUID = 397326046912649094L;
    /**
     * id主键
     */
    private int id;
    /**
    * 用户名
    */
    private String name;
    /**
    * 密码
    */
    private String pwd;
    /**
    * 用户权限
    */
    private Integer role;
    /**
    * 当前用户是否激活
    */
    private Integer active;
    /**
    * 工号
    */
    private String identity_id;
    /**
     * 创建时间
     */
    @JsonIgnore
    private Date create_time;
    /**
     * 修改时间
     */
    @JsonIgnore
    private Date update_time;
    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPwd() {
        return pwd;
    }

    public void setPwd(String pwd) {
        this.pwd = pwd;
    }

    public Integer getRole() {
        return role;
    }

    public void setRole(Integer role) {
        this.role = role;
    }

    public Integer getActive() {
        return active;
    }

    public void setActive(Integer active) {
        this.active = active;
    }

    public String getIdentity_id() {
        return identity_id;
    }

    public void setIdentity_id(String identity_id) {
        this.identity_id = identity_id;
    }
    public Date getCreate_time() {
        return create_time;
    }

    public void setCreate_time(Date create_time) {
        this.create_time = create_time;
    }

    public Date getUpdate_time() {
        return update_time;
    }

    public void setUpdate_time(Date update_time) {
        this.update_time = update_time;
    }

    public  JSONObject getUserMsg()  {
        JSONObject jsonObject  = new JSONObject(16, true);
        JSON.toJSONStringZ(jsonObject, SerializeConfig.getGlobalInstance(), SerializerFeature.QuoteFieldNames);
        jsonObject.put("id",id);
        jsonObject.put("identity_id",identity_id);
        jsonObject.put("name",name);
        jsonObject.put("role",role);
        jsonObject.put("active",active);
//        jsonObject.put("createTime",create_time);
//        jsonObject.put("updateTime",update_time);
        return jsonObject;
    }

}